package inc
{
	import flash.display.Stage;
	
	import mx.controls.Alert;
	import mx.controls.TextArea;
	
	public class Functions
	{	
		[Bindable]
		var text:String = "";
		var textArea:TextArea = null;
		
		public function Functions()
		{
		}
		
		//把秒数转为时间格式
		public function secToTime(sec:int):String{
			var m:String = int(sec/60) + ""; //分
			var s:String = sec%60 + "";  //秒
			if(m.length<2)
				m = "0"+m;
			if(s.length<2)
				s = "0"+s;
			return m+":"+s;
		}
		
		public function println(obj:Object, stage1:Stage):void{
			Alert.show(obj.toString());
			if(textArea==null){
				textArea = new TextArea();
				textArea.y = 0;
				textArea.y = 0;
				text = obj.toString();
				textArea.text = text;
				stage1.addChild(textArea);
			}else{
				textArea.text = text + "\n" + obj.toString();
			}
		}
	}
}